$(document).ready(function() {
	var citydata = returnCitySN;
	console.log(citydata.cname);
	$("#citytext").text(citydata.cname);
	//返回对象Object {cip: "122.70.200.146", cid: "110000", cname: "北京市"}
	getdata();
	getcompanydata();
	getteamdata();
});

var getdata = (function(result) {
	var peopleurl = dataport + '/ProjectConditionController/getPeopleNum';
	$.post(peopleurl, function(result) {
		var code = result.code;
		var list = result.object;
		if(code == 0) {
			$("#registerPeopleNum").text(list.registerPeopleNum);
			$("#realTimePeopleNum").text(list.realTimePeopleNum);
			$("#workPeopleNum").text(list.workPeopleNum);
		}
	})
})
//劳务公司
var getcompanydata = (function(result) {
	var companyurl = dataport + '/ProjectConditionController/getCheckStatistics';
	$.post(companyurl, function(result) {
		var code = result.code;
		var list = result.object;
		if(code == 0) {
			$.each(list, function(idx, obj) {
				var idx = idx + 1;
				var html = '<li>\
									<div class="company-name hy">' + obj.labourName + '</div>\
									<div class="company-data hy">' + obj.ratio + '</div>\
								</li>';
				$("#company-data").append(html);
				$("#company-data li:even").css("background-color", "rgba(58,82,131,0.2)");
			})
		}
	})
});

var getteamdata = (function(result) {
	var teamurl = dataport + '/ProjectConditionController/getTypeOfWork';
	$.post(teamurl, function(result) {
		var code = result.code;
		var list = result.object;
		console.log(list);
		if(code == 0) {
			$.each(list, function(idx, obj) {
				var idx = idx + 1;
				var thtml = '<li>\
									<span class="block block-color' + idx + '"></span>\
									<span class="profession-name">' + obj.type + ' </span>\
								</li>';
				var tnumhtml = '<li>\
									<div class="company-name hy">' + obj.type + '</div>\
									<div class="company-data data-c hy">' + obj.peopleNum + '</div>\
								</li>';
				$("#team-data").append(thtml);
				$("#team-people").append(tnumhtml);
				$("#team-people li:even").css("background-color", "rgba(58,82,131,0.2)");

			})
		}
	})
})